<template>
  <div id="assessdetail">
    <el-form :model="editForm" label-width="300px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" :rules="editFormRules" v-show="!pageLoading">
      <table cellspacing="0" cellpadding="0" class="mytable">
        <tr>
          <th style="min-width:100px;" >姓名</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.realname}}</template>
            </template>
            <template v-else>
              <el-form-item prop="realname">
                <el-input v-model="editForm.realname" />
              </el-form-item>
            </template>
          </td>
          <th style="min-width:100px;" >性别</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.sex}}</template>
            </template>
            <template v-else>
              <el-form-item prop="sex">
                <el-select v-model="editForm.sex" placeholder="请选择">
                  <el-option v-for="(item,index) in sexList" :key="'sex'+index" :label="item" :value="item" />
                </el-select>
              </el-form-item>
            </template>
          </td>
        </tr>
        <tr>
          <th style="min-width:100px;" >民族</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.nation}}</template>
            </template>
            <template v-else>
              <el-form-item prop="nation">
                <el-select v-model="editForm.nation" placeholder="请选择">
                  <el-option v-for="(item,index) in nationList" :key="'nation'+index" :label="item" :value="item" />
                </el-select>
              </el-form-item>
            </template>
          </td>
          <th style="min-width:100px;" >人员身份</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.identity}}</template>
            </template>
            <template v-else>
              <el-form-item prop="identity">
                <el-select v-model="editForm.identity" placeholder="请选择">
                  <el-option v-for="(item,index) in identityList" :key="'identity'+index" :label="item" :value="item" />
                </el-select>
              </el-form-item>
            </template>
          </td>
        </tr>
        <tr>
          <th style="min-width:100px;" >出生年月</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.birthday}}</template>
            </template>
            <template v-else>
              <el-form-item prop="birthday">
                <el-input v-model="editForm.birthday" style="width:170px" placeholder="如20201001或202010" />
                <el-tooltip class="item" effect="dark" content="格式：20201001或202010" placement="top">
                  <el-button type="text" icon="el-icon-info" />
                </el-tooltip>
              </el-form-item>
            </template>
          </td>
          <th style="min-width:100px;" >政治面貌</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.politicalAppearance}}</template>
            </template>
            <template v-else>
              <el-form-item prop="politicalAppearance">
                <el-select v-model="editForm.politicalAppearance" placeholder="请选择">
                  <el-option v-for="(item,index) in politicalAppearanceList" :key="'politicalAppearance'+index" :label="item" :value="item" />
                </el-select>
              </el-form-item>
            </template>
          </td>
        </tr>
        <tr>
          <th style="min-width:100px;" >毕业院校</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.school}}</template>
            </template>
            <template v-else>
              <el-form-item prop="school">
                <el-input v-model="editForm.school" />
              </el-form-item>
            </template>
          </td>
          <th style="min-width:100px;" >专业</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.major}}</template>
            </template>
            <template v-else>
              <el-form-item prop="major">
                <el-input v-model="editForm.major" />
              </el-form-item>
            </template>
          </td>
        </tr>
        <tr>
          <th style="min-width:100px;" >最高学历</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.education}}</template>
            </template>
            <template v-else>
              <el-form-item prop="education">
                <el-select v-model="editForm.education" placeholder="请选择">
                  <el-option v-for="(item,index) in educationList" :key="'education'+index" :label="item" :value="item" />
                </el-select>
              </el-form-item>
            </template>
          </td>
          <th style="min-width:100px;" >领导班子情况</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.leader}}</template>
            </template>
            <template v-else>
              <el-form-item prop="leader">
                <el-select v-model="editForm.leader" placeholder="请选择">
                  <el-option v-for="item in leaderOptions" :key="'leader_' + item" :label="item" :value="item" />
                </el-select>
              </el-form-item>
            </template>
          </td>
        </tr>
        <tr>
          <th style="min-width:100px;" >职务职级</th>
          <td style="min-width:200px;" colspan="3">
            <template v-if="readOnly" >
              <span v-for="(item, index) in editForm.job" :key="'job_' + index">
                {{ item.name }}（{{ item.level }}）
                <span v-if="index < editForm.job.length - 1">，</span>
              </span>
            </template>
            <template v-else>
              <el-form-item prop="job">
                <div v-for="(item, index) in editForm.job" :key="'job_' + index">
                  <div style="margin: 6px 0;">
                    <el-select v-model="item.level" placeholder="请选择职务层次">
                      <el-option v-for="(item,index) in levelOptions" :key="'level'+index" :label="item" :value="item" />
                    </el-select>
                    <el-input v-model="item.name" placeholder="请输入职务名称" style="width: 300px;"/>
                    <i v-if="editForm.job && editForm.job.length !== 1" class="el-icon-remove" @click="removeJobItem(index)" style="font-size: 26px; line-height: 40px; vertical-align: middle;"></i>
                  </div>
                </div>
                <i class="el-icon-circle-plus" @click="addJobItem()" style="font-size: 26px; vertical-align: middle;"></i>
              </el-form-item>
            </template>
          </td>
        </tr>
      </table>
      <div style="display: flex; align-items: center;" v-if="editForm.jbFlag||!readOnly">
        <el-checkbox v-model="editForm.jbFlag" v-if="!readOnly"></el-checkbox>
        <h3 style="margin-left: 10px;">在岗人员严重疾病情况</h3>
      </div>
      <table v-if="editForm.jbFlag" cellspacing="0" cellpadding="0" class="mytable">
        <tr>
          <th style="min-width:100px;" >所患疾病</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.shjb}}</template>
            </template>
            <template v-else>
              <el-form-item prop="shjb">
                <el-input v-model="editForm.shjb" style="width:800px" />
              </el-form-item>
            </template>
          </td>
        </tr>
        <tr>
          <th style="min-width:100px;" >附件</th>
          <td style="min-width:200px;">
            <el-upload
              v-if="!readOnly"
              v-model="jbFileList"
              :action="$http.defaults.baseURL+$http.defaults.unitReportAPI +'api/file/upload/'"
              :on-preview="handlePreview"
              :on-success="(response, file, fileList)=>{return handleUploadSuccJb(response, file, fileList)}"
              :on-error="uploadError"
              :before-remove="beforeRemove"
              :before-upload="beforeUpload"
              :show-file-list="false"
            >
              <el-button size="small" type="primary">上传附件</el-button>
            </el-upload>
            <template v-if="jbFileList && jbFileList.length > 0">
              <div v-for="item in jbFileList" :key="'jbFile_' + item.fileId" style="margin: 6px 0;">
                <a v-if="item.fileId" :href="$http.defaults.baseURL + $http.defaults.unitReportAPI + 'api/file/download?id='+item.fileId">{{item.fileName}}</a>
                <el-popconfirm
                  v-if="!readOnly"
                  title="这是一段内容确定删除吗？"
                  @confirm="delJbFile(item.fileId)"
                  @onConfirm="delJbFile(item.fileId)"
                >
                  <el-button slot="reference" size="mini" type="danger">删除</el-button>
                </el-popconfirm>
              </div>
            </template>
          </td>
        </tr>
      </table>
      <div style="display: flex; align-items: center;" v-if="editForm.scFlag||!readOnly">
        <el-checkbox v-model="editForm.scFlag" v-if="!readOnly"></el-checkbox>
        <h3 style="margin-left: 10px;">在岗人员伤残情况</h3>
      </div>
      <table v-if="editForm.scFlag" cellspacing="0" cellpadding="0" class="mytable">
        <tr>
          <th style="min-width:100px;" >伤残缘由</th>
          <td style="min-width:200px;">
            <template v-if="readOnly" >
              <template>{{editForm.scyy}}</template>
            </template>
            <template v-else>
              <el-form-item prop="scyy">
                <el-input v-model="editForm.scyy" style="width:800px" />
              </el-form-item>
            </template>
          </td>
          <th style="min-width:100px;" >程度</th>
          <td style="min-width:200px; vertical-align: middle;">
            <template v-if="readOnly" >
              <template>{{editForm.sccd}}</template>
            </template>
            <template v-else>
              <el-form-item prop="sccd">
                <el-input v-model="editForm.sccd" style="width: 300px;" />
              </el-form-item>
            </template>
          </td>
        </tr>
        <tr>
          <th style="min-width:100px;" >附件</th>
          <td style="min-width:200px;" colspan="3">
            <el-upload
              v-if="!readOnly"
              v-model="scFileList"
              :action="$http.defaults.baseURL+$http.defaults.unitReportAPI +'api/file/upload/'"
              :on-preview="handlePreview"
              :on-success="(response, file, fileList)=>{return handleUploadSuccSc(response, file, fileList)}"
              :on-error="uploadError"
              :before-remove="beforeRemove"
              :before-upload="beforeUpload"
              :show-file-list="false"
            >
              <el-button size="small" type="primary">上传附件</el-button>
            </el-upload>
            <template v-if="scFileList && scFileList.length > 0">
              <div v-for="item in scFileList" :key="'scFile_' + item.fileId" style="margin: 6px 0;">
                <a v-if="item.fileId" :href="$http.defaults.baseURL + $http.defaults.unitReportAPI + 'api/file/download?id='+item.fileId">{{item.fileName}}</a>
                <el-popconfirm
                  v-if="!readOnly"
                  title="这是一段内容确定删除吗？"
                  @confirm="delScFile(item.fileId)"
                  @onConfirm="delScFile(item.fileId)"
                >
                  <el-button slot="reference" size="mini" type="danger">删除</el-button>
                </el-popconfirm>
              </div>
            </template>
          </td>
        </tr>
      </table>
      <!-- <h3>个人所获表彰奖励情况（2017年11月以来）</h3>
      <div>
        <el-dialog
          title="新增"
          :visible.sync="awardFormVisible"
          append-to-body
          width="700px" top="20px" :close-on-click-modal="false" :close-on-press-escape="false">
          <el-form :model="awardForm" ref="awardForm" style="margin:10px 10px 0;clear:both" :rules="awardFormRules" label-width="100px">
            <el-form-item label="类型" prop="awardType">
              <el-select v-model="awardForm.awardType" placeholder="请选择" style="width:150px">
                <el-option label="国家级" value="国家级" />
                <el-option label="省部级" value="省部级" />
              </el-select>
            </el-form-item>
            <el-form-item label="奖励名称" prop="awardName">
              <el-input v-model="awardForm.awardName"  style="width:330px"></el-input>
            </el-form-item>
            <el-form-item label="附件" prop="job" v-if="awardForm.awardType==='国家级'">
              <el-upload
                v-model="fileList"
                :action="$http.defaults.baseURL+$http.defaults.unitReportAPI +'api/file/upload/'"
                :on-preview="handlePreview"
                :on-remove="(file, fileList)=>{return handleRemove(file, fileList)}"
                :on-success="(response, file, fileList)=>{return handleUploadSucc(response, file, fileList)}"
                :on-error="uploadError"
                :before-remove="beforeRemove"
                :before-upload="beforeUpload"
                :on-exceed="handleExceed"
                :limit="1"
                :file-list="fileList">
                <el-button size="small" type="primary">点击上传</el-button>
              </el-upload>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click.native="addAward">保存</el-button>
              注：国家级表彰奖励应上传附件予以细化说明。
            </el-form-item>
          </el-form>
        </el-dialog>
        <el-button v-if="!readOnly" type="success" style="margin:10px;" @click.native="showAwardForm">新增</el-button>
      </div>
      <el-table :data="awards" highlight-current-row style="width: 100%;border:1px solid #95B8E7;margin:0 10px 10px" border>
        <el-table-column type="index" label="序号" width="50" fixed align="center" class-name="tableth">
        </el-table-column>
        <el-table-column prop="awardType" label="类型" width="100">
        </el-table-column>
        <el-table-column prop="awardName" label="奖励名称">
        </el-table-column>
        <el-table-column prop="file" label="附件" width="300">
          <template slot-scope="scope">
            <a v-if="scope.row.fileId" :href="$http.defaults.baseURL + $http.defaults.unitReportAPI + 'api/file/download?id='+scope.row.fileId">{{scope.row.fileName}}</a>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="100" v-if="!readOnly">
          <template slot-scope="scope">
            <el-button size="mini" type="danger" @click="delAward(scope.$index)" v-if="!readOnly">删除</el-button>
          </template>
        </el-table-column>
      </el-table> -->
      <template v-if="!readOnly">
        <el-button type="primary" @click.native="editFormSubmit()" :loading="saveloading" style="margin-left:10px; margin-top: 10px;">保存</el-button>
      </template>
      <div style="height: 50px;"></div>
    </el-form>
  </div>
</template>

<script>
export default {
  watch: {
    timestamp: {
      async handler (val) {
        console.log('timestamp', val)
        this.editForm.scFlag = false
        this.editForm.jbFlag = false
        await this.getDic()
        await this.getDetail(this.projectId)
      },
      immediate: true
    },
    filterText (val) {
      this.$refs.tree.filter(val)
    }
  },
  props: {
    timestamp: '',
    projectId: null,
    readOnly: false,
    item: {}
  },
  data () {
    return {
      awardFormVisible: false,
      fileList: [],
      sexList: ['男', '女'],
      nationList: [],
      identityList: ['行政人员', '事业人员', '企业人员'],
      politicalAppearanceList: [],
      educationList: ['研究生', '全日制本科', '在职本科', '大专', '高中及以下'],
      editFormRules: {
        realname: [{ required: true, message: '必填项', trigger: 'blur' }],
        sex: [{ required: true, message: '必填项', trigger: 'blur' }],
        nation: [{ required: true, message: '必填项', trigger: 'blur' }],
        identity: [{ required: true, message: '必填项', trigger: 'blur' }],
        birthday: [{ required: true, message: '必填项', trigger: 'blur' }],
        politicalAppearance: [{ required: true, message: '必填项', trigger: 'blur' }],
        school: [{ required: true, message: '必填项', trigger: 'blur' }],
        education: [{ required: true, message: '必填项', trigger: 'blur' }],
        job: [{ required: true, message: '必填项', trigger: 'blur' }],
        leader: [{ required: true, message: '必填项', trigger: 'blur' }],
        shjb: [{ required: true, message: '必填项', trigger: 'blur' }],
        scyy: [{ required: true, message: '必填项', trigger: 'blur' }],
        sccd: [{ required: true, message: '必填项', trigger: 'blur' }]
      },
      limitNum: '',
      formData: [],
      pageLoading: false,
      saveloading: false,
      editForm: {
        realname: '',
        sex: '',
        nation: '',
        identity: '',
        birthday: '',
        politicalAppearance: '',
        school: '',
        marjor: '',
        education: '',
        job: [{level: '', name: ''}],
        leader: '',
        jbFlag: false,
        shjb: '',
        scFlag: false,
        scyy: '',
        sccd: '',
        liveFlag: 1
      },
      awardForm: {
        type: null,
        name: '',
        filename: ''
      },
      formFiles: {},
      awards: [
      ],
      awardFormRules: {
        awardType: [{ required: true, message: '必填项', trigger: 'blur' }],
        awardName: [{ required: true, message: '必填项', trigger: 'blur' }]
      },
      leaderOptions: ['正职', '副职', '无'],
      jbFileList: [],
      scFileList: [],
      levelOptions: ['省部级副职', '厅局级正职', '厅局级副职', '县处级正职', '县处级副职', '乡科级正职', '乡科级副职', '其他']
    }
  },
  methods: {
    addJobItem () {
      this.editForm.job.push({level: '', name: ''})
    },
    removeJobItem (index) {
      this.editForm.job.splice(index, 1)
    },
    showAwardForm () {
      this.awardForm = {
        type: null,
        name: '',
        filename: '',
        fileId: null,
        fileName: null
      }
      this.fileList = []
      this.awardFormVisible = true
    },
    delAward (index) {
      this.awards.splice(index, 1)
    },
    addAward () {
      this.$refs.awardForm.validate((valid) => {
        if (valid) {
          if (this.awardForm.awardType === '国家级' && !this.awardForm.fileId) {
            this.$message({
              message: '国家级表彰奖励应上传附件予以细化说明',
              type: 'error'
            })
            return false
          }
          if (this.awardForm.fileId) {
            this.awards.push({awardType: this.awardForm.awardType, awardName: this.awardForm.awardName, fileId: this.awardForm.fileId, fileName: this.awardForm.fileName})
          } else {
            this.awards.push({awardType: this.awardForm.awardType, awardName: this.awardForm.awardName})
          }
          this.awardForm = {
            type: null,
            name: '',
            filename: '',
            fileId: null,
            fileName: null
          }
          this.fileList = []
          this.awardFormVisible = false
        }
      })
    },
    getDic () {
      this.$http
        .get(this.$http.defaults.youngAPI + `api/young/jiben/getNationDictList`)
        .then(response => {
          if (response.data.success) {
            this.nationList = response.data.result.map(item => item.label)
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
      this.$http
        .get(this.$http.defaults.youngAPI + `api/young/jiben/getPoliticalDictList`)
        .then(response => {
          if (response.data.success) {
            this.politicalAppearanceList = response.data.result.map(item => item.label)
          } else {
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        })
        .catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
        })
    },
    handleUploadSuccJb (response, file, fileList) {
      this.saveloading = false
      if (response.success) {
        const fileObj = response.result[0]
        this.jbFileList.push({
          fileName: fileObj.fileName + '.' + fileObj.fileType,
          fileId: fileObj.id
        })
        this.$message({
          message: '上传成功！',
          type: 'success'
        })
      } else {
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    delJbFile (fid) {
      this.jbFileList = this.jbFileList.filter(item => item.fileId !== fid)
      this.$message({
        message: '删除成功！',
        type: 'success'
      })
    },
    handleUploadSuccSc (response, file, fileList) {
      this.saveloading = false
      if (response.success) {
        const fileObj = response.result[0]
        this.scFileList.push({
          fileName: fileObj.fileName + '.' + fileObj.fileType,
          fileId: fileObj.id
        })
        this.$message({
          message: '上传成功！',
          type: 'success'
        })
      } else {
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    delScFile (fid) {
      this.scFileList = this.scFileList.filter(item => item.fileId !== fid)
      this.$message({
        message: '删除成功！',
        type: 'success'
      })
    },
    uploadError (err) {
      this.saveloading = false
      console.log(err)
      this.$message({
        message: '上传失败:' + err,
        type: 'error'
      })
    },
    beforeRemove (file, fileList) {
      if (file && file.status === 'success') {
        return this.$confirm(`确定删除 ${file.name}？`)
      }
    },
    handleUploadSucc (response, file, fileList) {
      console.log(fileList)
      this.saveloading = false
      if (response.success) {
        let fileObj = fileList[0].response.result[0]
        this.awardForm.fileName = fileObj.fileName + '.' + fileObj.fileType
        this.awardForm.fileId = fileObj.id
        this.$message({
          message: '上传成功！' + response.message,
          type: 'success'
        })
      } else {
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    handlePreview (file) {
      if (window.navigator.msSaveOrOpenBlob) {
        navigator.msSaveBlob(this.$http.defaults.baseURL + this.$http.defaults.unitReportAPI + 'api/file/download?id=' + file.id, file.name)
      } else {
        var link = document.createElement('a')
        link.download = file.name
        link.href = this.$http.defaults.baseURL + this.$http.defaults.unitReportAPI + 'api/file/download?id=' + file.id
        link.click()
        console.log(this.$http.defaults.unitReportAPI + 'api/file/download?id=' + file.id)
        window.URL.revokeObjectURL(link.href)
      }
    },
    handleRemove (file, fileList) {
      if (file && file.status === 'success') {
        console.log(file, fileList)
        const fid = file.id
        const url = 'api/file/remove'
        let para = {
          params: {
            id: fid
          }
        }
        this.$http.get(this.$http.defaults.unitReportAPI + url, para).then(res => {
          console.log('删除成功:', res)
          this.awardForm.fileName = null
          this.awardForm.fileId = null
          this.$message({
            message: '删除成功！',
            type: 'success'
          })
        })
      }
    },
    beforeUpload (file) {
      // const isFormat = file.name.indexOf('.zip') > 0
      const isLt50M = file.size / 1024 / 1024 < 5000
      if (!isLt50M) {
        this.$message.error('单个附件不能超过50M!')
      } else {
        this.saveloading = true
      }
      return isLt50M
    },
    handleExceed (files, fileList) {
      this.$message.warning(`上传文件个数超限`)
    },
    editFormSubmit () {
      this.$refs['editForm'].validate((valid) => {
        if (valid) {
          if (this.readOnly) {
            this.$message({
              message: '测试提交成功！',
              type: 'success'
            })
          } else {
            const tempArr = this.editForm.job.filter(item => item.level !== '其他')
            if (tempArr.filter(item => !item.level || !item.name).length > 0) {
              this.$message({
                message: '请将职务职级填写完整',
                type: 'error'
              })
              return false
            }
            if (!this.isDate8(this.editForm.birthday) && !this.isDate6(this.editForm.birthday) && this.editForm.birthday) {
              this.$message({
                message: '出生年月格式有误，格式：20201001或202010',
                type: 'error'
              })
              return false
            }

            this.editForm.jbFileList = this.jbFileList
            this.editForm.scFileList = this.scFileList
            if (!this.editForm.scFlag) {
              this.editForm.scyy = ''
              this.editForm.sccd = ''
              this.editForm.scFileList = []
              this.scFileList = []
            }
            if (!this.editForm.jbFlag) {
              this.editForm.shjb = ''
              this.editForm.jbFileList = []
              this.jbFileList = []
            }
            // 返回父页面数据
            this.$emit('addData', JSON.parse(JSON.stringify(this.editForm)))
            // this.editForm = {}
          }
        }
      })
    },
    isDate8 (sDate) {
      if (!/^[0-9]{8}$/.test(sDate)) {
        return false
      }
      var year, month, day
      year = sDate.substring(0, 4)
      month = sDate.substring(4, 6)
      day = sDate.substring(6, 8)
      var iaMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
      if (year < 1700 || year > 2500) return false
      if (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) iaMonthDays[1] = 29
      if (month < 1 || month > 12) return false
      if (day < 1 || day > iaMonthDays[month - 1]) return false
      return true
    },
    isDate6 (sDate) {
      if (!/^[0-9]{6}$/.test(sDate)) {
        return false
      }
      var year, month
      year = sDate.substring(0, 4)
      month = sDate.substring(4, 6)
      if (year < 1700 || year > 2500) return false
      if (month < 1 || month > 12) return false
      return true
    },
    getDetail (id) {
      if (id) {
        this.pageLoading = true
        this.$http
          .get(this.$http.defaults.unitReportAPI + `api/project/getProjectById?id=` + id)
          .then(response => {
            this.editForm = {
              job: [{level: '', name: ''}],
              liveFlag: 1,
              jbFlag: false,
              scFlag: false
            }
            this.jbFileList = []
            this.scFileList = []
            if (this.item && JSON.stringify(this.item) !== '{}') {
              console.log('修改')
              this.editForm = JSON.parse(this.item.dataJson)
              this.editForm.scFlag = !!this.editForm.scFlag
              this.editForm.jbFlag = !!this.editForm.jbFlag
              this.editForm.id = this.item.id
              if (this.editForm.jbFileList) {
                this.jbFileList = this.editForm.jbFileList
              }
              if (this.editForm.scFileList) {
                this.scFileList = this.editForm.scFileList
              }
            }
            this.pageLoading = false
          })
          .catch(error => {
            this.$message({
              message: '网络获取失败:' + error,
              type: 'error'
            })
          })
      }
    }
  },
  mounted () {
    // this.getDic()
  }
}
</script>
<style>
#assessdetail .el-upload-list__item{
  width: 250px;
}
#assessdetail a{
  width: 200px;
}
.assessdetail .el-tabs__header{
  height: 29px;
  background: #FAFAFA;
  line-height: 30px;
  font-family: '宋体';
  padding:0 20px;
  border-bottom: 2px solid #E4E7ED;
  margin:0;
}
.assessdetail .el-tabs__item{
  line-height: 30px;
  height: 30px;
  font-weight:bolder;
}
  .cardtab .el-tabs__header{
    padding:0 !important;
    border-bottom:1px solid #E4E7ED;
  }
  #assessdetail .wboxs{
    height:45px;
    padding-top:0;
    margin-bottom: 10px;
  }
  .wboxs{
    padding:5px 15px;
    width: calc(100% - 30px);
    background: #fff;
    border: 1px solid #95B8E7;
    margin:0 10px;
    overflow: hidden;
  }
</style>

<style scoped>
  .tickettable th{
    font-weight:lighter;
    background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
    text-align: center;
  }
  .tickettable{
    width: 100%;
    border-left: 1px solid #95B8E7;
    border-top: 1px solid #95B8E7;
  }
  .tickettable td, .tickettable th{
    padding:5px 10px;
    margin:0;
    font-size:var(--size14) !important;
    line-height: 20px;
    font-family: '宋体';
    border-bottom: 1px solid #95B8E7;
    border-right: 1px solid #95B8E7;
  }
  .tickettable td{
    vertical-align: middle;
    text-align: center;
    font-weight: bolder;
  }
  .mytable{
    border-top: 1px solid #74a6cc;
    border-left: 1px solid #74a6cc;
    margin:0 10px 10px;
    width: calc(100% - 20px);
  }
  .mytable th{
    padding: 10px;
    border-right: 1px solid #74a6cc;
    border-bottom: 1px solid #74a6cc;
    line-height: 150%;
    background: #FAFAFA;
    width:200px;
    text-align:right;
  }
  .mytable td{
    padding: 10px;
    border-right: 1px solid #74a6cc;
    border-bottom: 1px solid #74a6cc;
    vertical-align: top;
    line-height: 150%;
  }
</style>
